import request from '@/utils/request'

export function getAllUser(data) {
  return request({
    url: `/v1/user/all`,
    method: 'get',
    params: data
  })
}

export function getUser(id) {
  return request({
    url: `/v1/user/${id}`,
    method: 'get'
  })
}

export function savePersonnel(data) {
  return request({
    url: `/v1/personnel/update/administrator`,
    method: 'post',
    data: data
  })
}

export function saveCompany(data) {
  return request({
    url: `/v1/enterprise/update/administrator`,
    method: 'post',
    data: data
  })
}

export function userRoom(data) {
  return request({
    url: `/v1/basic/userRoom`,
    method: 'put',
    data: data
  })
}

export function updateApply(data) {
  return request({
    url: `/v1/admin/personnel/audit/update`,
    method: 'put',
    data: data
  })
}

export function saveRole(data) {
  return request({
    url: `/v1/enterprise/update/role`,
    method: 'post',
    data: data
  })
}
// 新增老员工
export function userEntry(params) {
  return request({
    url: `/v1/user/entry`,
    method: 'post',
    params
  })
}

export function modifyList(data) {
  return request({
    url: `/v1/admin/personnel/modify/list`,
    method: 'get',
    params: data
  })
}

export function exportEntry(data) {
  return request({
    url: `/v1/enterprise/view/entry/table`,
    method: 'get',
    params: data
  })
}

//  获取企业档案
export const getEnterpriseArchives = (params) => {
  return request({
    url: '/v1/enterprise/view/administrator',
    method: 'GET',
    params
  })
}

export function signedAgreements(params) {
  return request({
    url: '/v1/agree/sign',
    method: 'GET',
    params
  })
}

export function fieldModifyHistory(params) {
  return request({
    url: '/v1/user/modification',
    method: 'GET',
    params
  })
}
// 人事档案统计
export function dataStatistics() {
  return request({
    url: '/v1/statistics/personnel',
    method: 'GET'
  })
}

// 导出人事档案信息
export function exportEmployeeInfo(data) {
  return request({
    url: '/v1/personnel/excel',
    method: 'POST',
    data
  })
}

// 获取编辑名片处的单位列表
export function getCompanyCardList(params) {
  return request({
    url: `/v1/company/card`,
    method: 'GET',
    params
  })
}

// 添加名片编辑处公司列表项
export function addCompanyCard(data) {
  return request({
    url: `/v1/company/card`,
    method: 'POST',
    data
  })
}

// 查询是否满足离职条件
export function resignationTesting(params) {
  return request({
    url: '/v1/user/resign',
    method: 'GET',
    params
  })
}
